package com.zha.controller;

import com.zha.domain.SysUser;
import com.zha.model.Result;
import com.zha.service.SysUserService;
import com.zha.util.AuthUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Title: 只有光头才能变强
 * @Author: 炸炸
 * @Date: 2024/12/17 10:45
 * 系统管理员业务控制层
 */
@Api(tags = "系统管理员接口管理")
@RequestMapping("/sys/user")
@RestController
public class SysUserController {

    @Resource
    private SysUserService sysUserService;


    @ApiOperation("查询登录用户信息")
    @GetMapping("info")
    public Result<SysUser> loadSysUserInfo() {
        // 获取登录用户标识
        Long userId = AuthUtils.geiLoginSysUserId();
        // 根据用户标识查询用户详情
        SysUser sysUser = sysUserService.getById(userId);
        return Result.success(sysUser);
    }
}
